<script setup lang="ts">
import { useRouter } from 'vue-router'

defineProps<{
  title?: string
}>()

const router = useRouter()
const onClickLeft = () => {
  if (history.state?.back) {
    router.back()
  } else {
    router.push('/')
  }
}
</script>

<template>
  <van-nav-bar
    left-arrow
    @click-left="onClickLeft"
    :title="title"
  ></van-nav-bar>
</template>

<style lang="scss" scoped>
:deep() {
  .van-nav-bar {
    &__left {
      padding-left: 10px;
    }
    &__content {
      height: 44px;
    }
    &__arrow {
      color: var(--cp-color1);
      font-size: 20px;
    }
    &__title {
      font-size: 17px;
      font-weight: 500;
    }
  }
}
</style>
